<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="#{man.skin0Culomns}"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="center">
        <h:form id="addRoleForm">
            <p:messages id="msg"/>
            <p:toolbar>
                <p:toolbarGroup align="left">

                    <a href="#{man.tplUrl}secure/role/add.xhtml" >
                        <p:commandButton type="button" value="Přidat roli"
                                         image="ui-icon-plus"  />
                    </a>

                    <p:commandButton type="button"
                                     onclick="deleteDialog.show()"
                                     update="display"
                                     image="ui-icon ui-icon-circle-close"
                                     value="Smazat roli"/>

                </p:toolbarGroup>
            </p:toolbar>
            <p:dataTable id="list" var="role" value="#{secureRoleMb.roles}"
                         paginator="true" rows="12" selectionMode="single">

                <f:facet name="header">
                    Seznam rolí
                </f:facet>

                <p:column filterBy="#{role.idRole}"
                          headerText="Název role"
                          filterMatchMode="contains"
                          style="width: 150px;">
                    <h:outputText value="#{role.idRole}" />
                </p:column>
                <p:column filterBy="#{role.desc}"
                          headerText="Popis role"
                          filterMatchMode="contains"
                          style="width: 150px;">
                    <h:outputText value="#{role.desc}" />
                </p:column>

            </p:dataTable>


            <p:dialog header="Smazat roli" widgetVar="deleteDialog"
                      resizable="false" width="230">

                <h:panelGrid style="text-align: center;" id="display" columns="1" cellpadding="1">

                    <h:outputText value="Opravdu chcete smazat roli?" />
                    <h:outputText>
                        <p:commandButton value="Ano"
                                         actionListener="#{secureRoleMb.remove}"
                                         update="addRoleForm"
                                         oncomplete="deleteDialog.hide();"/>
                        <p:spacer width="20" />
                        <p:commandButton value="Ne"
                                         oncomplete="deleteDialog.hide();"/>
                    </h:outputText>
                </h:panelGrid>
            </p:dialog>

        </h:form>
    </ui:define>

</ui:composition>
